package hibernate;

import java.util.Date;

/**
 *
 * @author Igor Kovb
 */
public class Request extends DBEntity  {

    private User user;
    private User manager;
    private Product product;
    private String description;
    private String comment;
    private Date inDate;
    private RequestStatus status;

    Request (){}
    
    /**
     * @return the user
     */
    public User getUser() {
        return user;
    }
    /**
     * @param user the user to set
     */
    public void setUser(User user) {
        this.user = user;
    }

      public User getManager() {
        return manager;
    }

    public void setManager(User manager) {
        this.manager = manager;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the comment
     */
    public String getComment() {
        return comment;
    }

    /**
     * @param comment the comment to set
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    /**
     * @return the status
     */
    public RequestStatus getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(RequestStatus status) {
        this.status = status;
    }

    /**
     * @return the product
     */
    public Product getProduct() {
        return product;
    }

    /**
     * @param product the product to set
     */
    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * @return the inDate
     */
    public Date getInDate() {
        return inDate;
    }

    /**
     * @param inDate the inDate to set
     */
    public void setInDate(Date inDate) {
        this.inDate = inDate;
    }
    
    @Override
    public String toString (){
        if (manager == null)
            return "�"+getId()+" from: "+user.getFirstName()+" "+user.getLastName() + " for product: "
                + product.getDescription() + " with description: "+description + " inDate: "
                + inDate.toString() + " current status: " + status.getDescription();
        return "�"+getId()+" from: "+user.getFirstName()+" "+user.getLastName() + " for product: "
                + product.getDescription() + " with description: "+description + " inDate: "
                + inDate.toString() + " current status: " + status.getDescription()
                +"manager" + manager.getFirstName()+ " " + manager.getLastName()+" manager comment: " + comment;
    }
    
}
